package org.jfonia.connect5.numerical;

import org.jfonia.connect5.basics.MutableValueNode;
import org.jfonia.connect5.basics.ValueNode;
import org.jfonia.connect5.relations.ABCRelation;

/**
 * Assure a + b = c
 *
 * Updates c if a or b changed, updates b if c changed
 *
 * @author wijnand.schepens@hogent.be
 *
 */
public class DoubleSumRelation extends ABCRelation<Double, Double, Double>
{
	public DoubleSumRelation(ValueNode<Double> a, MutableValueNode<Double> b, MutableValueNode<Double> c)
	{
		super(a, b, c);
	}

	public void updateB()
	{
		b.setValue(c.getValue() - a.getValue(), this);
	}

	public void updateC()
	{
		c.setValue(a.getValue() + b.getValue(), this);
	}

	
	
}
